data<-read.table("graph_r2.txt",sep=" ")
dim(data)
data[1,]
which(data[,16]<0.3)[1]
which(data$V16<0.3)[1]
which(data$V18<0.3)[1]
which(data$V18<0.3)
which(data$V18<0.3)
which(data$V16<0.3)
max(data$V16)
min(data$V16)
min(data$V18)
max(data$V18)
data[which(data$V16<0.25),data$V8]
data[which(data$V18<0.25),data$V12]
which(data$V18<0.25)
data[which(data$V18<0.25),12]
sum(data[which(data$V18<0.25),12])
sum(data[which(data$V18<0.25),13])
27805-21290
100*(6515/27805)
sum(data[which(data$V18>=0.25 & data$V18<0.5),13])
which(data$V18>=0.25 & data$V18<0.5)
data[20,]
sum(data[which(data$V18>=0.25 & data$V18<0.5),13])
sum(data[which(data$V18>=0.25 & data$V18<0.5),12])
54335-44075
10260/54335
sum(data[which(data$V18>=0.5 & data$V18<0.75),13])
sum(data[which(data$V18>=0.5 & data$V18<0.75),12])
134094-118390
 15704/134094
sum(data[which(data$V18>=0.75 & data$V18<=1),13])
sum(data[which(data$V18>=0.75 & data$V18<=1),12])
893889-867803
26086/893889
data[1,]
sum(data[which(data$V16>=0.25 & data$V16<0.5),9])
sum(data[which(data$V16>=0.25 & data$V16<0.5),8])
3339-3168
171/3339
sum(data[which(data$V16>=0.5 & data$V16<0.75),9])
sum(data[which(data$V16>=0.5 & data$V16<0.75),8])
54400-42914
11486/54400
100* 11486/54400
sum(data[which(data$V16>=0.75 & data$V16<=1),8])
sum(data[which(data$V16>=0.75 & data$V16<=1),9])
1052384-1016153
36231/1052384
length(which(data$V16>=0.75 & data$V16<=1))
length(which(data$V16>=0.5 & data$V16<=0.75))
length(which(data$V16>=0.25 & data$V16<=0.5))
length( which(data$V18>=0.25 & data$V18<0.5))
length( which(data$V18>=0.5 & data$V18<0.75))
length( which(data$V18>=0.75 & data$V18<=1))
length( which(data$V18<0.25))
dim(data)
data[1,]
pdf("imputation_discord_r2.pdf")
data[,19]<-100-data[,10]
data[,20]<-100-data[,14]
data[1,]
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples percentage",xlab="Dosage r2",ylab="Discordant samples percent",pch="*")
abline(lm(data[,19]~data[,16]), col="red")
points(data[,16],data[,19])
abline(lm(data[,19]~data[,16]), col="blue")
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples % per marker RED:IMPUTE BLUE:BEAGLE",xlab="Dosage r2",ylab="Discordant samples percent",pch="*")
abline(lm(data[,19]~data[,16]), col="red")
points(data[,18],data[,20])
abline(lm(data[,20]~data[,18]), col="blue")
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*")
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",co1=c("red"))
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
abline(lm(data[,19]~data[,16]), col="red")
points(data[,18],data[,20],pch="*",col=c("blue"))
abline(lm(data[,20]~data[,18]), col="blue")
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
lines(lowess(data[,16],data[,19]), col="red")
points(data[,18],data[,20],pch="*",col=c("blue"))
lines(lowess(data[,18],data[,20]), col="red")
dev.off()
library(sm)
install.packages(sm)
install.packages()
install.packages("http://cran.r-project.org/src/contrib/sm_2.2-4.1.tar.gz")
install.packages("sm")
library(sm)
help(sm)
 pdf("imputation_discord_r2.pdf")
sm.density.compare(data[,18],data[,20])
dev.off()
rnorm(10)
 pdf("imputation_discord_r2.pdf")
plot.ecdf(data[,18])
dev.off()
 pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
abline(v=knots(data[,19]),lty=2,col='gray70')
lines(data[,16],data[,19], col='blue')
dev,off()
dev.off()
 pdf("imputation_discord_r2.pdf")
plot(data[,16],data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
abline(data[,19],lty=2,col='gray70')
dev.off()
 pdf("imputation_discord_r2.pdf")
scatter.smooth(data[,16],data[,19])
dev.off()
ls
data[1,]
sum(data[which(data$V16>=0.25 & data$V16<0.5),8])
sum(data[,8)
sum(data[,8])
sum(data[,9])
sum(data[,12])
sum(data[,13])
1110123-1062235
100*(47888/1110123)
1110123-1051558
100*(58565/1110123)
 pdf("imputation_discord_r2.pdf")
plot(cumsum(data[,16]),data[,19],xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
dev.off()
cumsum(data[,16])
 pdf("imputation_discord_r2.pdf")
plot(data[,19],cumsum(data[,16]),xlim=c(0,1),ylim=c(0,100),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
dev.off()
 pdf("imputation_discord_r2.pdf")
max(cumsum(data[,16]))
dev.off()
dev.off()
data[1,]
pdf("imputation_discord_r2.pdf")
plot(data[,16],cumsum(data[,19]),xlim=c(0,1),ylim=c(0,max(cumsum(data[,19]))),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="Discordant samples percent",pch="*",col=c("red"))
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],cumsum(data[,19]))
dev.off()
pdf("imputation_discord_r2.pdf")
,max(cumsum(data[,19]))
,max(cumsum(data[,19])))
max(cumsum(data[,19]))
max(cumsum(data[,20]))
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],cumsum(data[,19]),xlim=c(0,1),ylim=c(0,5300),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="cummulative Discordant samples percent",pch="*",col=c("red"))
abline(lm(cumsum(data[,19])~data[,16]), col="red")
points(data[,18],cumsum(data[,20]))
abline(lm(cumsum(data[,20])~data[,18]), col="blue")
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],cumsum(data[,19]),xlim=c(0,1),ylim=c(0,5300),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="cummulative Discordant samples percent",pch=".",col=c("red"))
abline(lm(cumsum(data[,19])~data[,16]), col="red")
points(data[,18],cumsum(data[,20]),pch=".",col=c("blue"))
abline(lm(cumsum(data[,20])~data[,18]), col="blue")
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data[,16],cumsum(data[,19]),type="l")
dev.off()
cumsum(data[,19])[1:5]
data[1,]
data1<-data[with(data, order(V16)), ]
data1[1,]
 pdf("imputation_discord_r2.pdf")
 plot(data1[,16],cumsum(data1[,19]),xlim=c(0,1),ylim=c(0,5300),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="cummulative Discordant samples percent",pch=".",col=c("red"))
 abline(lm(cumsum(data1[,19])~data1[,16]), col="red")
data1<-data[with(data, order(V18)), ]
points(data1[,18],cumsum(data1[,20]),pch=".",col=c("blue"))
dev.off()
pdf("imputation_discord_r2.pdf")
plot(data1[,16],cumsum(data1[,19]),xlim=c(0,1),ylim=c(0,5300),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="cummulative Discordant samples percent",pch=".",col=c("red"),tpye="l")
plot(data1[,16],cumsum(data1[,19]),xlim=c(0,1),ylim=c(0,5300),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="cummulative Discordant samples percent",pch=".",col=c("red"),type="l")
dev.off()
pdf("imputation_discord_r2.pdf")
data1<-data[with(data, order(V16)), ]
plot(data1[,16],cumsum(data1[,19]),xlim=c(0,1),ylim=c(0,5300),main="Dosage r2 vs Discordant samples RED:IMP BLUE:BEA",xlab="Dosage r2",ylab="cummulative Discordant samples percent",pch=".",col=c("red"),type="l")
data1<-data[with(data, order(V18)), ]
points(data1[,18],cumsum(data1[,20]),pch=".",col=c("blue"),type="l")
dev.off()
savehistory("Rscript_r2.R")
